package com.hdoit.ares.logical.acc.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.hdoit.ares.logical.acc.dao.IIncomeInfoDao;
import com.hdoit.ares.logical.acc.model.IncomeInfo;
import com.hdoit.ares.logical.acc.service.IIncomeInfoService;
import com.hdoit.ares.logical.cust.model.Customer;
import com.tennetcn.common.dao.base.impl.SuperService;
import com.tennetcn.common.enums.ModelStatus;
import com.tennetcn.common.utils.CommonUtils;
/**
 * @author      lvsi
 * @email       
 * @createtime  2017年12月19日 14:18:27
 * @comment
 */
@Component
public class IncomeInfoServiceImpl extends SuperService<IncomeInfo> implements IIncomeInfoService{

	private IIncomeInfoDao incomeInfoDao;
	
	public IIncomeInfoDao getIncomeInfoDao() {
		return incomeInfoDao;
	}
	@Resource
	public void setIncomeInfoDao(IIncomeInfoDao incomeInfoDao) {
		this.incomeInfoDao = incomeInfoDao;
	}

	@Override
	public IncomeInfo queryIncomeInfo(String id) {
		
		return incomeInfoDao.queryIncomeInfo(id);
	}
	
	@Override
	public boolean addIncomeInfo(Customer customer) {
		IncomeInfo incomeInfo = new IncomeInfo();
		incomeInfo.setId(CommonUtils.getKeyId());
		incomeInfo.setIncomeBalance(0);
		incomeInfo.setCustomerId(customer.getId());
		incomeInfo.setServiceAward(0);
		incomeInfo.setHatcheryAward(0);
		incomeInfo.setPromotionAward(0);
		incomeInfo.setFirstSharingAward(0);
		incomeInfo.setSecondSharingAward(0);
		incomeInfo.setModelStatus(ModelStatus.add);		
		return applyChange(incomeInfo);
	}
	@Override
	public Double queryIncomeBalance(String id) {
		
		return incomeInfoDao.queryIncomeBalance(id);
	}

}